<template>
  <div class="container">
    <div class="row">
      <div class="col-12">
        <ProjectAnalysisTable @row-selected="handleRowSelected" />
      </div>
      <div class="col-12">
        <div class="card">
          <div class="card-header">
            <h5 class="card-title">{{ selectedProject?.name }} 作者贡献</h5>
          </div>
          <div class="card-body">
            <ProjectAuthorTable :selectedProject="selectedProject ?? {}" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import ProjectAnalysisTable from '@/components/analysis/ProjectAnalysisTable.vue';
import ProjectAuthorTable from '@/components/analysis/ProjectAuthorTable.vue';
import type { Project } from '@/types/business/project';

const selectedProject = ref<Project | null>(null);

const handleRowSelected = (row: Project) => {
  selectedProject.value = row;
};
</script>
